﻿<UserControl x:Class="AnthStat.WPF.Presentation.Controls.NewPerson"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="240" d:DesignWidth="400">
    <Border BorderBrush="{StaticResource AccentVeryLightBrush}" BorderThickness="1" Background="White" Padding="10">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <StackPanel Grid.Row="0" Margin="0, 0, 0, 20">
                <TextBlock FontWeight="SemiBold" FontSize="24" Text="NEW RECORD"/>
                <!--<TextBlock FontWeight="Normal" FontSize="12" Foreground="{StaticResource AccentBrush}" Text="Individual Assessments"/>-->
            </StackPanel>

            <Grid Grid.Row="1" DataContext="{Binding ChildrenView.CurrentItem}">
                <Grid.Resources>
                    <Style TargetType="TextBox">
                        <Setter Property="Padding" Value="2" />
                        <Setter Property="FontSize" Value="12" />
                        <Setter Property="Margin" Value="0, 2, 0, 2" />
                        <Setter Property="VerticalAlignment" Value="Center" />
                    </Style>
                </Grid.Resources>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="50" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

                <TextBlock Grid.Row="0" Grid.Column="0" Style="{StaticResource DemographicsTextBlockStyle}"
                                           Text="First name" />

                <TextBlock Grid.Row="1" Grid.Column="0" Style="{StaticResource DemographicsTextBlockStyle}"
                                           Text="Last name" />

                <TextBlock Grid.Row="2" Grid.Column="0" Style="{StaticResource DemographicsTextBlockStyle}">
                    <Run>Sex</Run> <Run Foreground="Red" FontWeight="Bold">*</Run>
                </TextBlock>

                <TextBlock Grid.Row="3" Grid.Column="0" Style="{StaticResource DemographicsTextBlockStyle}">
                    <Run>Date of birth</Run> <Run Foreground="Red" FontWeight="Bold">*</Run>
                </TextBlock>


                <TextBox HorizontalAlignment="Stretch" Grid.Row="0" Grid.Column="2" Width="Auto"
                                         Text="{Binding FirstName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True}"/>

                <TextBox HorizontalAlignment="Stretch" Grid.Row="1" Grid.Column="2" Width="Auto"
                                         Text="{Binding LastName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True}"/>

                <ComboBox HorizontalAlignment="Stretch" Grid.Row="2" Grid.Column="2" VerticalAlignment="Center" ItemsSource="{StaticResource SexArray}" SelectedValuePath="ValueString" DisplayMemberPath="DisplayString" SelectedValue="{Binding Sex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                
                <!--<StackPanel HorizontalAlignment="Left" Grid.Row="2" Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center" >
                    <RadioButton GroupName="GROUP_1" Content="Male" IsChecked="{Binding Sex, Mode=TwoWay, Converter={StaticResource MaleToCheckedConverter}}" />
                    <StackPanel Width="10" />
                    <RadioButton GroupName="GROUP_1" Content="Female"  IsChecked="{Binding Sex, Mode=TwoWay, Converter={StaticResource FemaleToCheckedConverter}}" />
                </StackPanel>-->

                <StackPanel Orientation="Horizontal" Grid.Row="3" Grid.Column="2" VerticalAlignment="Center">
                    <DatePicker HorizontalAlignment="Left" FontSize="12" VerticalAlignment="Center"
                                            SelectedDate="{Binding DateBirth, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True}"/>

                    <StackPanel Width="10" />

                    <CheckBox VerticalAlignment="Center" IsChecked="{Binding IsDateBirthEstimated, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Content="Estimated date" />
                </StackPanel>

            </Grid>

            <StackPanel Grid.Row="2" Grid.ColumnSpan="3" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0, 30, 0, 0" >
                <Button Style="{StaticResource DarkButtonStyle}" Width="100" IsEnabled="True" Background="{StaticResource AccentLightBrush}" Content="OK"
                        Command="{Binding CloseAddPersonPromptCommand}" />
                <StackPanel Width="10" />
                <Button Style="{StaticResource DarkButtonStyle}" Width="100" IsEnabled="True" Background="{StaticResource AccentLightBrush}" Content="Cancel"
                        Command="{Binding RemovePersonCommand}"/>
            </StackPanel>
        </Grid>
    </Border>
</UserControl>
